from core.support import set_cutscene
from core.item import Item
from core.action import Action

class stilts(Item):
    def __init__(self):
        Item.__init__(self, "stilts")    # do basic initialization for every item
        
        # build list of actions
        self.add_action(use_stilts)
    
    def get_description(self):
        return "Stilts"
        
    def get_image(self):
        return "Stilts.jpg"

# define actions for this item
class use_stilts(Action):
    def __init__(self):
        Action.__init__(self, "put_on_stilts")    # do basic initialization for every action
        self.isItemAction=True
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Put on the stilts"
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "post"
    
    # only works in basement. add cutscene
    def do_action(self,game,room,request):
        if room.get_id() == 'breadwinners':
            room.using_stilts = True
            set_cutscene("You put on the stilts and are able to walk above the swarms of undergrads.")
            room.use_stilts()
               
    #            else:
    #                set_cutscene("You put on the stilts and are able to walk past the swarms of undergrads.")
    #                room.treasure_locked = False
    #        else:
    #            set_cutscene("You already used the stilts.")
        else:
            set_cutscene("This is the incorrect place to use the stilts.")
        return
    
    def is_enabled(self):
        return True
    
   